package soundwave.com.demo.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import soundwave.com.demo.R;

/**
 * Created by xu on 2017/4/9.
 */

public class Modify_password1 extends Activity {
    private TextView back;
    private EditText original_password;
    private EditText new_password;
    private Button modify_button;
    private String old_word,new_word;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.modify_password1);
        initView();
        onclik();
    }

    private void initView() {
        back = (TextView) findViewById(R.id.back);
        original_password = (EditText) findViewById(R.id.original_password);
        new_password = (EditText) findViewById(R.id.new_password);
        modify_button = (Button) findViewById(R.id.modify_button);


    }
    private void onclik(){
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        modify_button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                old_word=original_password.getText().toString();
                new_word=new_password.getText().toString();
                if (old_word.equals("")){
                    Toast.makeText(Modify_password1.this, "旧密码不能空！", Toast.LENGTH_SHORT).show();
                }else if (old_word.length()<6){
                    Toast.makeText(Modify_password1.this, "旧密码不能少于6位！", Toast.LENGTH_SHORT).show();
                }else {
                    if (new_word.equals("")){
                        Toast.makeText(Modify_password1.this, "新密码不能为空！", Toast.LENGTH_SHORT).show();
                    }else if (new_word.length()<6){
                        Toast.makeText(Modify_password1.this, "新密码不能少于6位！", Toast.LENGTH_SHORT).show();
                    }else {
                        Toast.makeText(Modify_password1.this, "修改成功", Toast.LENGTH_SHORT).show();
                        finish();
                    }
                }

            }
        });
    }



}
